package {
	import mx.core.UITextField;
	import flash.text.TextFieldAutoSize;
	import mx.controls.Button;
	//import spark.components .Button;
	import flash.display.DisplayObject;
	
	
	public class MButton extends Button {
		

		override protected function createChildren() : void {
			if (!textField) {
				textField = new UITextField();
				textField.styleName = this;
				addChild(DisplayObject(textField));
			}
			
			super.createChildren();
			textField.multiline = true;
			textField.wordWrap = true;
			textField.autoSize = TextFieldAutoSize.CENTER;
			
		}
		
	override  protected function updateDisplayList(unscaledWidth : Number, unscaledHeight : Number) : void{
		
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			textField.y = (this.height - textField.height) >> 1;
			height = textField.textHeight; 
			
		}
	}
}